package com.gxuwz.business.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gxuwz.business.dao.impl.MedicineDAO;
import com.gxuwz.business.entity.Medicine;
import com.gxuwz.business.service.IMedicineService;
import com.gxuwz.util.Pager;

@Service("medicineService")
public class MedicineServiceImpl implements IMedicineService {
	
	@Autowired
	private MedicineDAO medicineDAO;

	@Override
	public boolean add(Medicine medicine) {
		// TODO Auto-generated method stub
		return medicineDAO.add(medicine);
	}

	@Override
	public boolean update(Medicine medicine) {
		// TODO Auto-generated method stub
		return medicineDAO.update(medicine);
	}

	@Override
	public boolean delete(Medicine medicine) {
        return medicineDAO.delete(medicine);		
	}

	@Override
	public Medicine findById(Medicine medicine) {
		return medicineDAO.findById(medicine);
	}

	@Override
	public List<Medicine> getAll(Class T) {
		return medicineDAO.getAll(T);
	}

	/**
	 * 分页查询
	 */
	@Override
	public Pager<Medicine> getByPager(Medicine medicine, Integer page, Integer limit) {
		return medicineDAO.getByPager(medicine, page, limit);
	}

	@Override
	public boolean checkMedName(Medicine medicine) {
		return medicineDAO.checkMedName(medicine);
	}

	@Override
	public String getMedName(String medId) {
		return medicineDAO.getMedName(medId);
	}

	@Override
	public Double getMedPrice(String medId) {
		return medicineDAO.getMedPrice(medId);
	}

}
